package me.keiwu.user.domain;

import lombok.Data;
import org.hibernate.annotations.ColumnDefault;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;

/**
 * Created by kei on 31/01/2018.
 */
@Data
@Entity
@Table(uniqueConstraints = {
        @UniqueConstraint(name = "uidx_userId_medalId", columnNames = {"userId", "medalId"})
})
public class MedalPresent extends AbstractBaseEntity {


    @Id
    @GeneratedValue
    private Integer id;

    private Long userId;

    private String nickName;

    private Integer medalId;

    @Column(length = 50)
    private String name;

    @Column(length = 255)
    private String address;

    @Column(length = 20)
    private String telephone;

    @Column(length = 15)
    private String zip;

    @ColumnDefault("0")
    @Column(columnDefinition = "TINYINT", nullable = false, length = 1)
    private boolean hasSent;


    @Transient
    private Medal medal;

}
